function g3 = dynamic_g3(T, y, x, params, steady_state, it_, T_flag)
% function g3 = dynamic_g3(T, y, x, params, steady_state, it_, T_flag)
%
% File created by Dynare Preprocessor from .mod file
%
% Inputs:
%   T             [#temp variables by 1]     double   vector of temporary terms to be filled by function
%   y             [#dynamic variables by 1]  double   vector of endogenous variables in the order stored
%                                                     in M_.lead_lag_incidence; see the Manual
%   x             [nperiods by M_.exo_nbr]   double   matrix of exogenous variables (in declaration order)
%                                                     for all simulation periods
%   steady_state  [M_.endo_nbr by 1]         double   vector of steady state values
%   params        [M_.param_nbr by 1]        double   vector of parameter values in declaration order
%   it_           scalar                     double   time period for exogenous variables for which
%                                                     to evaluate the model
%   T_flag        boolean                    boolean  flag saying whether or not to calculate temporary terms
%
% Output:
%   g3
%

if T_flag
    T = M15b.dynamic_g3_tt(T, y, x, params, steady_state, it_);
end
g3_i = zeros(56,1);
g3_j = zeros(56,1);
g3_v = zeros(56,1);

g3_i(1)=1;
g3_i(2)=1;
g3_i(3)=1;
g3_i(4)=1;
g3_i(5)=1;
g3_i(6)=1;
g3_i(7)=1;
g3_i(8)=1;
g3_i(9)=1;
g3_i(10)=1;
g3_i(11)=1;
g3_i(12)=1;
g3_i(13)=1;
g3_i(14)=1;
g3_i(15)=1;
g3_i(16)=1;
g3_i(17)=2;
g3_i(18)=2;
g3_i(19)=2;
g3_i(20)=2;
g3_i(21)=2;
g3_i(22)=2;
g3_i(23)=2;
g3_i(24)=2;
g3_i(25)=2;
g3_i(26)=2;
g3_i(27)=2;
g3_i(28)=2;
g3_i(29)=2;
g3_i(30)=2;
g3_i(31)=2;
g3_i(32)=2;
g3_i(33)=2;
g3_i(34)=2;
g3_i(35)=2;
g3_i(36)=2;
g3_i(37)=5;
g3_i(38)=5;
g3_i(39)=5;
g3_i(40)=5;
g3_i(41)=5;
g3_i(42)=5;
g3_i(43)=5;
g3_i(44)=5;
g3_i(45)=5;
g3_i(46)=5;
g3_i(47)=7;
g3_i(48)=7;
g3_i(49)=9;
g3_i(50)=9;
g3_i(51)=9;
g3_i(52)=9;
g3_i(53)=10;
g3_i(54)=10;
g3_i(55)=10;
g3_i(56)=10;
g3_j(1)=564;
g3_j(2)=567;
g3_j(3)=572;
g3_j(4)=615;
g3_j(5)=620;
g3_j(6)=700;
g3_j(7)=820;
g3_j(8)=823;
g3_j(9)=828;
g3_j(10)=871;
g3_j(11)=876;
g3_j(12)=956;
g3_j(13)=1639;
g3_j(14)=1644;
g3_j(15)=1724;
g3_j(16)=3004;
g3_j(17)=3294;
g3_j(18)=3285;
g3_j(19)=3295;
g3_j(20)=3141;
g3_j(21)=3151;
g3_j(22)=3311;
g3_j(23)=820;
g3_j(24)=828;
g3_j(25)=956;
g3_j(26)=3550;
g3_j(27)=3541;
g3_j(28)=3551;
g3_j(29)=3397;
g3_j(30)=3407;
g3_j(31)=3567;
g3_j(32)=1093;
g3_j(33)=1103;
g3_j(34)=1263;
g3_j(35)=3004;
g3_j(36)=3823;
g3_j(37)=1;
g3_j(38)=7;
g3_j(39)=9;
g3_j(40)=103;
g3_j(41)=105;
g3_j(42)=137;
g3_j(43)=1639;
g3_j(44)=1641;
g3_j(45)=1673;
g3_j(46)=2185;
g3_j(47)=615;
g3_j(48)=1639;
g3_j(49)=1;
g3_j(50)=7;
g3_j(51)=103;
g3_j(52)=1639;
g3_j(53)=1;
g3_j(54)=7;
g3_j(55)=103;
g3_j(56)=1639;
g3_v(1)=T(17)*T(43)-T(18)*T(44);
g3_v(2)=T(22)*T(39)-T(23)*T(40);
g3_v(3)=T(17)*T(47)-T(18)*((-y(12))*T(35)*T(48)-T(48));
g3_v(4)=T(4)*(params(4)-1)*params(8)*T(70)-T(6)*(params(4)-1)*T(70);
g3_v(5)=T(36)*T(39)-T(6)*T(35)*T(40);
g3_v(6)=T(17)*T(52)-T(18)*T(35)*T(6)*T(35);
g3_v(7)=T(1)*((T(21)*T(41)+T(20)*(-1)/(y(4)*y(4))+T(21)*T(41)+log(y(4))*T(71)+T(21)*T(41)+T(20)*(-1)/(y(4)*y(4))+T(20)*(-1)/(y(4)*y(4))+T(2)*(y(4)+y(4))/(y(4)*y(4)*y(4)*y(4)))/(y(12)-1)+T(71)/T(3))-T(5)*T(72);
g3_v(8)=T(31)*T(43)-T(32)*T(44);
g3_v(9)=T(1)*(((y(12)-1)*(T(21)*((1-y(12))*T(35)*T(45)-T(45))+log(y(4))*((1-y(12)-1)*(1-y(12))*T(35)*T(73)+T(73)*(-(1-y(12)+1-y(12)-1)))+T(21)*((1-y(12))*T(35)*T(45)-T(45))+T(2)*T(35)*(-1)/(y(4)*y(4)))-T(42))/((y(12)-1)*(y(12)-1))+(T(3)*((1-y(12)-1)*(1-y(12))*T(35)*T(73)+T(73)*(-(1-y(12)+1-y(12)-1)))-2*(y(12)-1)*T(41))/(T(3)*T(3)))-T(5)*(((-y(12))-1)*(-y(12))*T(35)*T(74)+T(74)*(-((-y(12))-1-y(12))));
g3_v(10)=T(22)*(params(4)-1)*params(8)*T(49)-T(23)*(params(4)-1)*T(49);
g3_v(11)=T(31)*T(47)-T(32)*((-y(12))*T(35)*T(48)-T(48));
g3_v(12)=T(1)*(((y(12)-1)*(y(12)-1)*(y(12)-1)*(log(y(4))*T(75)+T(21)*T(35)*T(2)*T(35))-T(46)*(y(12)-1+y(12)-1))/((y(12)-1)*(y(12)-1)*(y(12)-1)*(y(12)-1))+(T(3)*T(3)*(2*(y(12)-1)*((1-y(12))*T(35)*T(45)-T(45))+T(3)*T(75)-(2*(y(12)-1)*((1-y(12))*T(35)*T(45)-T(45))+2*T(20)))-(T(3)*((1-y(12))*T(35)*T(45)-T(45))-T(20)*2*(y(12)-1))*(T(3)*2*(y(12)-1)+T(3)*2*(y(12)-1)))/(T(3)*T(3)*T(3)*T(3)))-T(5)*((-y(12))*T(35)*T(35)*T(48)-T(35)*T(48)-T(35)*T(48));
g3_v(13)=T(4)*(params(4)-1)*params(8)*T(76)-(params(2)*getPowerDeriv(y(7),params(7),3)+T(6)*(params(4)-1)*T(76));
g3_v(14)=T(36)*(params(4)-1)*params(8)*T(49)-T(6)*T(35)*(params(4)-1)*T(49);
g3_v(15)=T(31)*T(52)-T(32)*T(35)*T(6)*T(35);
g3_v(16)=T(1)*(((y(12)-1)*(y(12)-1)*(y(12)-1)*(y(12)-1)*((y(12)-1)*log(y(4))*T(35)*T(2)*T(35)*(y(12)-1+y(12)-1)+(y(12)-1)*(y(12)-1)*(log(y(4))*T(35)*T(2)*T(35)+(y(12)-1)*log(y(4))*T(35)*T(35)*T(2)*T(35))-((y(12)-1)*log(y(4))*T(35)*T(2)*T(35)*(y(12)-1+y(12)-1)+2*((y(12)-1)*log(y(4))*T(2)*T(35)-T(2)*log(y(4)))))-T(50)*((y(12)-1)*(y(12)-1)*(y(12)-1+y(12)-1)+(y(12)-1)*(y(12)-1)*(y(12)-1+y(12)-1)))/((y(12)-1)*(y(12)-1)*(y(12)-1)*(y(12)-1)*(y(12)-1)*(y(12)-1)*(y(12)-1)*(y(12)-1))+(T(3)*T(3)*T(3)*T(3)*(T(77)+T(3)*T(3)*(2*(y(12)-1)*T(35)*T(2)*T(35)+2*T(2)*T(35)+2*(y(12)-1)*T(35)*T(2)*T(35)+T(3)*T(35)*T(35)*T(2)*T(35)-(2*T(2)*T(35)+2*(y(12)-1)*T(35)*T(2)*T(35)+2*T(2)*T(35)))-(T(77)+(T(3)*T(2)*T(35)-(T(2)-1)*2*(y(12)-1))*(2*(y(12)-1)*2*(y(12)-1)+2*T(3)+2*(y(12)-1)*2*(y(12)-1)+2*T(3))))-T(51)*(T(3)*T(3)*(T(3)*2*(y(12)-1)+T(3)*2*(y(12)-1))+T(3)*T(3)*(T(3)*2*(y(12)-1)+T(3)*2*(y(12)-1))))/(T(3)*T(3)*T(3)*T(3)*T(3)*T(3)*T(3)*T(3)))-T(5)*T(35)*T(35)*T(6)*T(35);
g3_v(17)=T(19)*T(56)-params(4)*T(19)*T(57);
g3_v(18)=T(26)*T(53)-T(27)*params(4)*T(53);
g3_v(19)=T(19)*T(60)-params(4)*T(19)*params(1)*((-y(15))*T(37)*T(61)-T(61));
g3_v(20)=T(9)*(y(5)+y(5))/(y(5)*y(5)*y(5)*y(5))-T(12)*params(4)*(y(5)+y(5))/(y(5)*y(5)*y(5)*y(5));
g3_v(21)=T(38)*T(53)-params(1)*T(11)*T(37)*params(4)*T(53);
g3_v(22)=T(19)*T(65)-params(4)*T(19)*params(1)*T(37)*T(11)*T(37);
g3_v(23)=T(72);
g3_v(24)=((-y(12))-1)*(-y(12))*T(35)*T(74)+T(74)*(-((-y(12))-1-y(12)));
g3_v(25)=(-y(12))*T(35)*T(35)*T(48)-T(35)*T(48)-T(35)*T(48);
g3_v(26)=T(10)*params(4)*params(8)*params(1)*((T(25)*T(54)+T(24)*(-1)/(y(14)*y(14))+T(25)*T(54)+log(y(14))*T(78)+T(25)*T(54)+T(24)*(-1)/(y(14)*y(14))+T(24)*(-1)/(y(14)*y(14))+T(7)*(y(14)+y(14))/(y(14)*y(14)*y(14)*y(14)))/(y(15)-1)+T(78)/T(8))-(1-params(3)+params(4)*T(10))*params(1)*getPowerDeriv(y(14),(-y(15)),3);
g3_v(27)=T(30)*T(56)-params(4)*T(30)*T(57);
g3_v(28)=T(10)*params(4)*params(8)*params(1)*(((y(15)-1)*(T(25)*((1-y(15))*T(37)*T(58)-T(58))+log(y(14))*((1-y(15)-1)*(1-y(15))*T(37)*T(79)+T(79)*(-(1-y(15)+1-y(15)-1)))+T(25)*((1-y(15))*T(37)*T(58)-T(58))+T(7)*T(37)*(-1)/(y(14)*y(14)))-T(55))/((y(15)-1)*(y(15)-1))+(T(8)*((1-y(15)-1)*(1-y(15))*T(37)*T(79)+T(79)*(-(1-y(15)+1-y(15)-1)))-2*(y(15)-1)*T(54))/(T(8)*T(8)))-(1-params(3)+params(4)*T(10))*params(1)*(((-y(15))-1)*(-y(15))*T(37)*T(80)+T(80)*(-((-y(15))-1-y(15))));
g3_v(29)=T(26)*T(62)-T(27)*params(4)*T(62);
g3_v(30)=T(30)*T(60)-params(4)*T(30)*params(1)*((-y(15))*T(37)*T(61)-T(61));
g3_v(31)=T(10)*params(4)*params(8)*params(1)*(((y(15)-1)*(y(15)-1)*(y(15)-1)*(log(y(14))*T(81)+T(25)*T(37)*T(7)*T(37))-T(59)*(y(15)-1+y(15)-1))/((y(15)-1)*(y(15)-1)*(y(15)-1)*(y(15)-1))+(T(8)*T(8)*(2*(y(15)-1)*((1-y(15))*T(37)*T(58)-T(58))+T(8)*T(81)-(2*(y(15)-1)*((1-y(15))*T(37)*T(58)-T(58))+2*T(24)))-(T(8)*((1-y(15))*T(37)*T(58)-T(58))-T(24)*2*(y(15)-1))*(T(8)*2*(y(15)-1)+T(8)*2*(y(15)-1)))/(T(8)*T(8)*T(8)*T(8)))-(1-params(3)+params(4)*T(10))*params(1)*((-y(15))*T(37)*T(37)*T(61)-T(37)*T(61)-T(37)*T(61));
g3_v(32)=T(9)*T(82)-T(12)*params(4)*T(82);
g3_v(33)=T(38)*T(62)-params(1)*T(11)*T(37)*params(4)*T(62);
g3_v(34)=T(30)*T(65)-params(4)*T(30)*params(1)*T(37)*T(11)*T(37);
g3_v(35)=T(35)*T(35)*T(6)*T(35);
g3_v(36)=T(10)*params(4)*params(8)*params(1)*(((y(15)-1)*(y(15)-1)*(y(15)-1)*(y(15)-1)*((y(15)-1)*log(y(14))*T(37)*T(7)*T(37)*(y(15)-1+y(15)-1)+(y(15)-1)*(y(15)-1)*(log(y(14))*T(37)*T(7)*T(37)+(y(15)-1)*log(y(14))*T(37)*T(37)*T(7)*T(37))-((y(15)-1)*log(y(14))*T(37)*T(7)*T(37)*(y(15)-1+y(15)-1)+2*((y(15)-1)*log(y(14))*T(7)*T(37)-T(7)*log(y(14)))))-T(63)*((y(15)-1)*(y(15)-1)*(y(15)-1+y(15)-1)+(y(15)-1)*(y(15)-1)*(y(15)-1+y(15)-1)))/((y(15)-1)*(y(15)-1)*(y(15)-1)*(y(15)-1)*(y(15)-1)*(y(15)-1)*(y(15)-1)*(y(15)-1))+(T(8)*T(8)*T(8)*T(8)*(T(83)+T(8)*T(8)*(2*(y(15)-1)*T(37)*T(7)*T(37)+2*T(7)*T(37)+2*(y(15)-1)*T(37)*T(7)*T(37)+T(8)*T(37)*T(37)*T(7)*T(37)-(2*T(7)*T(37)+2*(y(15)-1)*T(37)*T(7)*T(37)+2*T(7)*T(37)))-(T(83)+(T(8)*T(7)*T(37)-(T(7)-1)*2*(y(15)-1))*(2*(y(15)-1)*2*(y(15)-1)+2*T(8)+2*(y(15)-1)*2*(y(15)-1)+2*T(8))))-T(64)*(T(8)*T(8)*(T(8)*2*(y(15)-1)+T(8)*2*(y(15)-1))+T(8)*T(8)*(T(8)*2*(y(15)-1)+T(8)*2*(y(15)-1))))/(T(8)*T(8)*T(8)*T(8)*T(8)*T(8)*T(8)*T(8)))-(1-params(3)+params(4)*T(10))*params(1)*T(37)*T(37)*T(11)*T(37);
g3_v(37)=(-(T(14)*exp(y(9))*T(84)));
g3_v(38)=(-(T(33)*exp(y(9))*T(66)));
g3_v(39)=(-(T(14)*exp(y(9))*T(66)));
g3_v(40)=(-(exp(y(9))*T(28)*T(67)));
g3_v(41)=(-(exp(y(9))*T(28)*T(33)));
g3_v(42)=(-(T(14)*exp(y(9))*T(28)));
g3_v(43)=(-(T(13)*exp(y(9))*T(85)));
g3_v(44)=(-(T(13)*exp(y(9))*T(67)));
g3_v(45)=(-(T(13)*exp(y(9))*T(33)));
g3_v(46)=(-(T(13)*exp(y(9))*T(14)));
g3_v(47)=(-T(70));
g3_v(48)=(-T(76));
g3_v(49)=(-(T(14)*params(4)*getPowerDeriv(y(1),params(4)-1,3)));
g3_v(50)=(-(T(33)*T(68)));
g3_v(51)=(-(T(29)*T(67)));
g3_v(52)=(-(T(15)*T(85)));
g3_v(53)=(-(T(16)*(1-params(4))*T(84)));
g3_v(54)=(-(T(34)*(1-params(4))*T(66)));
g3_v(55)=(-((1-params(4))*T(28)*T(69)));
g3_v(56)=(-(T(13)*(1-params(4))*getPowerDeriv(y(7),(-params(4)),3)));
g3 = sparse(g3_i,g3_j,g3_v,10,4096);
end
